package cn.itsource.itsource.controller;

import cn.itsource.itsource.domain.LinYu;
import cn.itsource.itsource.domain.Pet;
import cn.itsource.itsource.domain.WangLin;
import cn.itsource.itsource.query.PetQuery;
import cn.itsource.itsource.query.WangLinQuery;
import cn.itsource.itsource.service.IWangLinService;
import cn.itsource.itsource.util.AjaxResult;
import cn.itsource.itsource.util.PageList;
import cn.itsource.itsource.vo.PetVo;
import cn.itsource.itsource.vo.ProductVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/fuwu")
public class WangLinController {

    @Autowired
    private IWangLinService wangLinService;

    @PostMapping("/findpage")
    public PageList findPage(@RequestBody WangLinQuery query){


        return wangLinService.findPage(query);

    }

    @PostMapping("/saveorupdate")
    @ResponseBody
    public AjaxResult saveOrUpdate(@RequestBody WangLin wangLin){

        return wangLinService.saveOrUpdate(wangLin);
    }

    @GetMapping("/del")
    @ResponseBody
    public AjaxResult del(Long id){

        return wangLinService.del(id);
    }

    @PostMapping("queryHomePage")
    public PageList queryHomePage(@RequestBody WangLinQuery query){
        return wangLinService.queryHomePage(query);
    }

    @GetMapping("/{id}")
    public ProductVo getDetailById(@PathVariable("id") Long id) {
        return wangLinService.getDetailById(id);
    }

    @GetMapping("/findproductbyid/{id}")
    public WangLin findProductById(@PathVariable("id") Long id){
        return wangLinService.findProductById(id);
    }

}
